// 引入所有需要注册的全局组件
import FilterSelect2 from '@/components/FilterSelect2'
import TopTitle from '@/components/TopTitle/newtitle.vue'
import Twobtn from '@/components/Twobtn'
import TopTooltip from '@/components/TopTooltip'
import TableColumn from '@/components/Table/index.vue'
import FileUpload from '@/components/FileUpload'

const globalComponents = [
  { name: 'FilterSelect2', component: FilterSelect2 },
  { name: 'TopTitle', component: TopTitle },
  { name: 'Twobtn', component: Twobtn },
  { name: 'TopTooltip', component: TopTooltip },
  { name: 'TableColumn', component: TableColumn },
  { name: 'FileUpload', component: FileUpload }
]

export default {
  install(Vue) {
    globalComponents.forEach((component) => {
      // 这里用的是组件里面的name
      //如果引入的组件没有写name，会报错 ： vue.esm.js:100 Uncaught TypeError: Cannot read properties of undefined (reading 'toLowerCase')
      Vue.component(component.name, component.component)
    })
  }
}
